package com.example.demos.util;

public class CheckSonStr {
    public static boolean checkSonStr(String fatherStr,String sonStr){
        StringBuilder stringBuilder = new StringBuilder();
        int left = 0;
        int right = 0;
        for (left = 0; left < fatherStr.length() - sonStr.length() + 1; left++) {
            stringBuilder.delete(0,sonStr.length());
            int n = 0;
            while (n < sonStr.length()){
                stringBuilder.append(fatherStr.charAt(right));
                right++;
                n++;
            }
            if (sonStr.equals(stringBuilder.toString())){
                return true;
            }
            right = left + 1;
        }
        return false;
    }
}
